//
//  QLRecordManager.h
//  QLCustomCamera_Example
//
//  Created by 李强 on 2020/8/31.
//  Copyright © 2020 李强LiQ. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "QLRecordParam.h"
#import <GPUImage/GPUImage.h>
#import "QLGPUImageView.h"

NS_ASSUME_NONNULL_BEGIN


@protocol QLRecordManagerVCDelegate <NSObject>

//录制完成
-(void)recordFinishedWithOutputFileUrl:(NSURL *)fileUrl RecordTime:(CGFloat)recordTime;
//录制时间
-(void)reloadRecordTime:(CGFloat)time;
//隐藏闪光灯
-(void)lightIsHidden:(BOOL)isHidden;
//添加预览view
-(void)showPreviewView:(QLGPUImageView *)displayView;

@end


@protocol QLRecordManagerDelegate <NSObject>

//@optional
//获取拍摄的照片
-(void)getTakenPhoto:(UIImage *)photo;
//获取视频数据流
-(void)getVideoData:(NSData *)outputData url:(NSURL *)outputUrl;
//录制时间
-(void)getRecordTime:(CGFloat)time;
//录制封面
-(void)getRecordVideoCoverUrl:(NSURL *)coverUrl image:(UIImage *)coverImage;
//获取视频数据流,录制封面
-(void)getVideoData:(NSData *)outputData dataUrl:(NSURL *)outputUrl coverUrl:(NSURL *)coverUrl coverImage:(UIImage *)coverImage;
// recordTime:(CGFloat)recordTime
@end



@interface QLRecordManager : NSObject

/**是否在录制*/
@property (nonatomic,assign)BOOL isRecording;
/**视频参数*/
@property (nonatomic,strong)QLRecordParam *recordParam;

@property (nonatomic,weak)id <QLRecordManagerVCDelegate>vcDelegate;

@property (nonatomic,weak)id <QLRecordManagerDelegate>delegate;


+(QLRecordManager*)shareManager;

+(UIViewController*)getRecordViewController;

//配置参数
-(void)configVideoParamsWithRecordParam:(QLRecordParam*)param;
//拍照片
-(void)shootPhoto;
//拍照结束
-(void)endShootPhoto;
//保存照片
-(void)savePhoto;
//获取拍摄照片
-(UIImage*)getPhoto;
//开始录制
-(void)startRecord;
//停止录制
-(void)endRecord;
//切换摄像头
-(void)turnCamera;
//闪光灯
-(void)changeLightWithState:(AVCaptureTorchMode)state;
//改变滤镜
-(void)changeFilter:(GPUImageFilter *)filter;
//美颜
-(void)isOpenBeauty:(BOOL)isBeauty;
//保存视频
-(void)saveVideo;
//视频压缩
-(void)videoCompressionURL:(NSURL *)videoURL CompletionHandler:(void(^)(NSURL*))handler;
//停止重力感应
-(void)stopDeviceMotionUpdates;



@end

NS_ASSUME_NONNULL_END
